import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CveService } from 'src/app/core/service/cve.service';

@Component({
  selector: 'app-threat-list-detail',
  templateUrl: './threat-list-detail.component.html',
  styleUrls: ['./threat-list-detail.component.scss'],
})
export class ThreatListDetailComponent implements OnInit {
  cveName: string;
  cnnvdId: string;
  dataSet: any;
  cnnvd: any;
  constructor(
    private cveservice: CveService,
    private routeInfo: ActivatedRoute,
  ) { }

  /**
     *
     * @param reset 获取数据
     */
  getCVEDetailPage(reset: boolean = false): void {
    console.log('进入Detail', this.cveName);
    this.cveservice.getCVEDetailPage(this.cveName)
      .subscribe((CVEDetailPage) => {
        console.log(`===收到detail数据===> ${CVEDetailPage}`);
        this.dataSet = CVEDetailPage;
        console.log('===datail现在的数据===', this.dataSet);
      });
  }

  ngOnInit() {
    this.cveName = this.routeInfo.snapshot.queryParams['cveName'];
    this.getCVEDetailPage();
  }

}
